<template>
	<el-dialog title="" width="900px" visible :show-close="false" :append-to-body="true"  class="wrap">
		<i class="el-icon-close close" @click="cancel" style="color: white;"></i>
		<div class="bt">{{ybjmc}}-班级升级</div>
		<el-form label-width="100px" class="form">
			<el-tabs v-model="activeName" type="card" >
			    <el-tab-pane label="班级信息" name="first">
			    	<div class="zzz">
				<div class="an" style="width: 100%;text-align: center;float: left;">
					<div class="en1">
						<el-button type="warning" class="submit" @click="cancel">关闭</el-button>
						<!--<el-button type="success" class="submit" v-if="!this.$route.query.ysj" @click="submit(1)">升级</el-button>-->
						<el-button type="success" class="submit" v-if="this.$route.query.ysj" @click="baocun()">保存</el-button>
						<el-button type="success" class="submit" v-if="this.$route.query.ysj && this.kblistul.length>0" @click="kaiban()">开班</el-button>
					</div>

					<div class="en2">
						<el-form-item label="班级名称" class="inp">
							<el-input v-model="ybjmc" disabled></el-input>
						</el-form-item>
					</div>
				</div>
				<div class="left" style="float: left;width: 50%; margin-top: 10px;">
					<el-form-item label="班级名称">
						<el-input v-model="form.mc" placeholder="请输入" class="select-block"></el-input>
					</el-form-item>
					<el-form-item label="课程名称">
						<el-select v-model="form.fxkcid" placeholder="请选择课程" class="select-block">
							<el-option :label="v.mc" :value="v.id+''" v-for="v in xzkclist"></el-option>
						</el-select>
						<!--<p style="height:20px; font-size:16px; line-height:20px;">剩余课时数量({{form.kscnt}})</p>-->
					</el-form-item>
					<!--<el-form-item label="课程名称">
						<el-select v-model="form.fxkcid" placeholder="请选择课程" class="select-block">
							<el-option :label="v.mc" :value="v.id+''" v-for="v in xzkclist"></el-option>
						</el-select>
					</el-form-item>-->

					<el-form-item label="老师名称">
						<el-select v-model="form.lsid" class="select-block">
							<el-option :label="v.zwm" :value="v.id+''" v-for="v in comboxlist"></el-option>
						</el-select>
					</el-form-item>
				</div>
				<div class="right" style="float: left;width: 50%;margin-top: 10px;">
					<el-form-item label="行政老师">
						<el-select v-model="form.xzid" class="select-block">
							<el-option :label="v.zwm" :value="v.id+''" v-for="v in xzlsList"></el-option>
						</el-select>
					</el-form-item>

					<el-form-item label="教材名称">
						<el-input v-model="form.jcmc" placeholder="请选择教材名称" class="select-block1" icon="add" :readonly="true"></el-input>
						<el-button size="small" @click="showwp()" class="select-block2">选择</el-button>

					</el-form-item>

					<el-form-item label="开班日期">
						<!--时间出来-->
						<!--:picker-options="pickerOptions0"-->  
						<el-date-picker v-model="form.yjkbrq" type="date"  :editable="false" class="select-block" placeholder="选择日期" @keyup.enter.native="search"> </el-date-picker>
					</el-form-item>
				</div>

				<div style="float: left;width: 100%;">
					<el-form-item label="备注">
						<el-input v-model="form.note" placeholder="" style="width:80%;"></el-input>
					</el-form-item>
				</div>
			</div>
			<div style="width: 100%;height: 50px; overflow: hidden;line-height: 50px;">
				<span style="width: 100px; font-size: 25px; margin-left: 65px;">课表</span>
				<el-button type="warning" size="small " style="float: right;margin-right: 65px; margin-top: 10px;" @click="czkb()">重置课表</el-button>
			</div>
			<ul class="kblistul">
				<li style="cursor:pointer;" v-for="i in this.kblistul" @click="daike(i)" :class="(i.issk=='Y'? 'red':'red2')" :style="i.iscf > 0 || i.lsiscf > 0? 'background:#8D8383;color:#fff':'background:#fff'">
					<p>{{i.sj}}({{i.week}})</p>
					<p>{{i.xh}}</p>
					<p>{{i.jsmc}}</p>
					<p>{{i.zwm}}</p>
					<p>{{i.sjd}}</p>
				</li>
			</ul>
			    </el-tab-pane>
			    <el-tab-pane label="班级订单" name="second">
			    	<!--教材-->
			    	<div>
			    	<div class="jftop1">
					<span class="span1" style="width: 100%;">
						<span style="float: left;">教材</span>
					</span>
				</div>
			    	<el-table :data="dataList" border stripe size='small' type="mini" align="center" class="admin-table" sum-text>
					<div slot='empty'>
						<img src="../../../assets/img/empty.png" style="width:40px;vertical-align: middle;">
						<span style="vertical-align: middle;">您还没有选择教材哦!</span>
					</div>
					<el-table-column :prop="v.prop" :label="v.label" v-for="(v,index) in portTitleList" align="center" show-overflow-tooltip v-if="v.hide != 0" :formatter="v.formatter" :align="v.align || 'center'" :fixed="v.fixed" :class-name="v.columnStyle" :width="v.width" :header-align="v.headerAlign || 'center'">
						<template scope="scope">
							<div slot="reference" :style="tableCellControl(scope)" v-if="scope.column.property === 'cnt'">
								<el-input class="content-input" type="number" v-model="scope.row[scope.column.property]"></el-input>
								<!-- :disabled="scope.row.type === '物品' && scope.column.property === 'zk' ? true:false" -->
							</div>
							<div slot="reference" v-else-if=" scope.column.property == 'zk'">
								<el-input class="content-input" type="number" v-model="scope.row[scope.column.property]" @change="callzhi()"></el-input>
							</div>
							<div slot="reference" v-else-if="scope.column.property === 'zj'">
								{{scope.row.jcjg * scope.row.cnt * scope.row.zk*1/100 || 0}}
							</div>
							<div slot="reference" v-else>
								{{ scope.row[scope.column.property] }}
							</div>
						</template>
					</el-table-column>

					<el-table-column label="操作" align="center" width="100px">
						<template scope="scope">
							<el-button size="small" type="danger" @click="bc(scope)" >保存</el-button>
						</template>
					</el-table-column>
				</el-table>
				</div>
				<!--课程-->
				<div style="margin-top: 10px;">
			    	<div class="jftop1">
					<span class="span1" style="width: 100%;">
						<span style="float: left;">课程</span>
					</span>
				</div>
			    	<el-table :data="dataList1" border stripe size='small' type="mini" align="center" class="admin-table2" sum-text>
					<div slot='empty'>
						<img src="../../../assets/img/empty.png" style="width:40px;vertical-align: middle;">
						<span style="vertical-align: middle;">您还没有选择课程哦!</span>
					</div>
					<el-table-column :prop="v.prop" :label="v.label" v-for="(v,index) in portTitleList1" align="center" show-overflow-tooltip v-if="v.hide != 0" :formatter="v.formatter" :align="v.align || 'center'" :fixed="v.fixed" :class-name="v.columnStyle" :width="v.width" :header-align="v.headerAlign || 'center'">
						<template scope="scope">
							<div slot="reference" :style="tableCellControl(scope)" v-if="scope.column.property === 'cnt'">
								<el-input class="content-input" type="number" v-model="scope.row[scope.column.property]"></el-input>
								<!-- :disabled="scope.row.type === '物品' && scope.column.property === 'zk' ? true:false" -->
							</div>
							<div slot="reference" v-else-if=" scope.column.property == 'zk'">
								<el-input class="content-input" type="number" v-model="scope.row[scope.column.property]" @change="callzhi()"></el-input>
							</div>
							<div slot="reference" v-else-if="scope.column.property === 'zj'">
								{{scope.row.jcjg * scope.row.cnt * scope.row.zk*1/100 || 0}}
							</div>
							<div slot="reference" v-else>
								{{ scope.row[scope.column.property] }}
							</div>
						</template>
					</el-table-column>

					<el-table-column label="操作" align="center" width="100px">
						<template scope="scope">
							<el-button size="small" type="danger" @click="bc(scope)" >保存</el-button>
						</template>
					</el-table-column>
				</el-table>
				</div>
				
				<el-button type="success"   style='margin-left: 0;margin-top: 10px;' size="small" :disabled="multipleDeleteDisabled" icon="el-icon-edit" @click="tjxx()">添加学生订单</el-button>
			      <el-table :data="xsdataList" stripe  border size="small"  @select="checkSelect" @select-all="checkall" style="width: 100%" >
			      	 <el-table-column type="selection" width="35" show-overflow-tooltip></el-table-column>
			      	<el-table-column prop="zwm"  label="中文名"    width=""></el-table-column>
			      	<el-table-column prop="ywm"  label="英文名"    width=""></el-table-column>
					<el-table-column prop="dh"   label="电话"  width=""></el-table-column>
					<el-table-column prop="kcxq"   label="课程购买详情"  width=""></el-table-column>
					<el-table-column prop="jcxq" label="教材购买详情"  width=""></el-table-column>
				  </el-table>
				  <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="pageindex" :page-sizes="pagesizes" :page-size="pagesize" :layout="layout" :total="total" class="class-page">
					</el-pagination>
			      </el-tab-pane>
			    </el-tab-pane>
			    
            </el-tabs>
			
			
			
		</el-form>
			<Czkb @close="cloczkb" :params="this.form" v-if="showczkblist"></Czkb>
			<Kschoose :params="form.fxkcid" @close="wpchoosecancel" v-if="showchoselist"></Kschoose>
	</el-dialog>
</template>
<script type="text/javascript">
	import qs from 'qs'
	import Czkb from '@/view/admin/yushebjManage/czkb'
	import Kschoose from 'view/manage/kssz/kschoose'
	import PayArticle from 'view/admin/yushebjManage/pay-articlejc'
	import Bjxs from 'view/admin/yushebjManage/bjxs'
	// import Jskb from './kebiao/jskb'
	import Lskb from 'view/admin/yushebjManage/kebiao/lskb'
	import Jskb from 'view/admin/yushebjManage/kebiao/jskb'
	import Jslskb from 'view/admin/yushebjManage/kebiao/jslskb'

	export default {
		props: ['params'],
		components: {
			Kschoose,
			PayArticle,
			Bjxs,
			Lskb,
			Jskb,
			Jslskb,
			Czkb
		},
		data() {
			return {
//				pickerOptions0: {
//		          disabledDate(time) {
//		             return time.getTime() < Date.now() + 8.64e6      
//		          }
//		        },
		        dataList:[],
		        dataList1:[],
		        xsdataList:[],
		        activeName:'first',
				showchoselist:false,
				showczkblist: false,
				multipleDelNum: '',
            	multipleDeleteDisabled: true,
				xzkclist:[],
				comboxlist:[],
				xzlsList:[],
				kblistul:[],
				ybjmc:'',
				form: {
					fxkcmc: '',
					mc: '',
					lsmc: '',
					lsid: '',
					xzid: '',
					cmc: '',
					jcmc: '',
					isqy: '',
					kcid: '',
					id: '',
					xzls: '',
					yjkbrq: '',
					kbsjd: '',
					note: '',
					xzlsmc: '',
					kss: '',
					jsid: '',
					kccnt: '',
					bjid:'1',
					
				},
				/*分页属性设置*/
				layout: 'total, sizes, prev, pager, next, jumper', //组件布局
				pageindex: 1, //当前分页页码
				pagesizes: [6], //显示个数的选择器选项
				pagesize: 6, //每页显示条目数
				total: 0, //总条数
				portTitleList: [{
						prop: 'id',
						label: 'id',
						hide: 0,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '',
						headerAlign: 'center'
					},
					{
						prop: 'bjid',
						label: 'bjid',
						hide: 0,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '100',
						headerAlign: 'center'
					},{
						prop: 'bjmc',
						label: 'bjmc',
						hide: 0,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '100',
						headerAlign: 'center'
					},{
						prop: 'fxkcid',
						label: '课程id',
						hide: 0,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '100',
						headerAlign: 'center'
					},{
						prop: 'spmc',
						label: '教材名称',
						hide: 1,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '100',
						headerAlign: 'center'
					},
					{
						prop: 'jcjg',
						label: '基础价格',
						hide: 0,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '100',
						headerAlign: 'center'
					},
					{
						prop: 'zkjcjg',
						label: '折扣基础价格',
						hide: 1,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '100',
						headerAlign: 'center'
					},
					{
						prop: 'cnt',
						label: '课时',
						hide: 1,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '100',
						headerAlign: 'center'
					},
					{
						prop: 'zk',
						label: '折扣',
						hide: 1,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '100',
						headerAlign: 'center'
					},
					{
						prop: 'zj',
						label: '教材总价',
						hide: 1,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '100',
						headerAlign: 'center'
					},
				],
//				教材
				portTitleList1: [{
						prop: 'id',
						label: 'id',
						hide: 0,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '',
						headerAlign: 'center'
					},
					{
						prop: 'bjid',
						label: 'bjid',
						hide: 0,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '100',
						headerAlign: 'center'
					},{
						prop: 'bjmc',
						label: 'bjmc',
						hide: 0,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '100',
						headerAlign: 'center'
					},{
						prop: 'spid',
						label: '教材id',
						hide: 0,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '100',
						headerAlign: 'center'
					},{
						prop: 'spmc',
						label: '课程名称',
						hide: 1,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '100',
						headerAlign: 'center'
					},
					{
						prop: 'jcjg',
						label: '基础价格',
						hide: 0,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '100',
						headerAlign: 'center'
					},
					{
						prop: 'zkjcjg',
						label: '折扣基础价格',
						hide: 1,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '100',
						headerAlign: 'center'
					},
					{
						prop: 'cnt',
						label: '课时',
						hide: 1,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '100',
						headerAlign: 'center'
					},
					{
						prop: 'zk',
						label: '折扣',
						hide: 1,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '100',
						headerAlign: 'center'
					},
					{
						prop: 'zj',
						label: '课程总价',
						hide: 1,
						align: 'center',
						fixed: false,
						width: '',
						minWidth: '100',
						headerAlign: 'center'
					},
				],
				
				// 分页
//				layout: 'total, sizes, prev, pager, next, jumper', //组件布局
//				pageindex: this.$store.state.pageindex, //当前分页页码
//				pagesizes: this.$store.state.pagesizes, //显示个数的选择器选项
//				pagesize: this.$store.state.pagesize, //每页显示条目数
//				total: 0, //总条数
			}
		},
		created() {
//			console.log(this.params,'kkkkkk')
			if(this.$route.query.ysj == 'ysj') {
				this.form.id = this.$route.query.iid
				this.ybjmc = this.$route.query.bjmc
			}
		    else if(this.params) {
					this.form.id = this.params.bjid;
					this.ybjmc = this.params.bjmc;
			} 
//			alert(this.form.id)
			this.getxzkclist();//课程
			this.loadinfo(); //info
			
			this.getjslist();
			this.getcomboxlist(); //laoshi
			this.getcomboxlist1(); //xingzheng
			this.bjddlist();
			this.xslist();
			//this.xs();
			//			this.kb();
		},

		methods: {
			tableCellControl(scope) { //表格单元格控制CSS样式
				// console.log(scope)
				/*if (scope.row.id == 112 && scope.column.property == "iname") {
				    return {
				        color:"red",
				    }
				}else{
				    return {
				        color:"green",
				    }
				}*/
			},
			callzhi(strvalue) {
				for(let i in this.dataList) {
					var o = this.dataList[i];
					if(o.zk > 100) {
						o.zk = 100
						this.$message.error('输入的折扣不能大于100！');
					}
					if(o.zk < 0) {
						o.zk = 0
						this.$message.error('输入的折扣不能小于0！');
					}
				}
			},
			czkb() {
//				console.log(this.form,5555555)
				this.showczkblist = true;
			},
			cloczkb() {
				this.showczkblist = false;
				this.getkblist();
			},
			showwp() {
				this.showchoselist = true;
			},
			showjc() {
				this.showarticle = true;
			},
			bjddlist() {
				var logininfo = JSON.parse(localStorage.logininfo);
				this.searchLoading = true;
				var params2 = qs.stringify({
					lx: '1',
					bjid: this.form.bjid,
					yhid: logininfo.id,
					xxid: logininfo.xxid
				})
				//执行
				this.axios.post(this.$store.state.api + 'bjorder/list1', params2)
					.then(res => {
//						console.log(res, 'ffff')
						this.dataList = res.data.data.list;
					}).catch(res => {})
					
					var params2 = qs.stringify({
					lx: '2',
					bjid: this.form.bjid,
					yhid: logininfo.id,
					xxid: logininfo.xxid
				})
				//执行
				this.axios.post(this.$store.state.api + 'bjorder/list1', params2)
					.then(res => {
//						console.log(res, 'wwwww')
						this.dataList1 = res.data.data.list;
					}).catch(res => {})
			},
			bc(scope) {
//				console.log(scope,'lllll')
				this.$store.state.loading = true;
				var logininfo = JSON.parse(localStorage.logininfo);
				var params3 = qs.stringify({
					cnt: scope.row.cnt,
					zk: scope.row.zk,
					zj: scope.row.zj,
					zkjcjg: scope.row.zkjcjg,
					id: scope.row.id,
					yhid: logininfo.id,
					xxid:logininfo.xxid
				});
				//执行
				this.axios.post(this.$store.state.api + 'bjorder/update', params3)
					.then(res => {
						if(res.data.code == 1) {
							this.$message.success(res.data.msg);
							this.$store.state.loading = false;
						} else {
							this.$message.warning(res.data.msg);
							this.$store.state.loading = false;
						}
					}).catch(res => {
						this.$message.danger("服务器繁忙，请重试");
						this.$store.state.loading = false;
					})
			},
			xslist() {
//				alert(this.form.id)
//				alert(this.form.bjid)
				var logininfo = JSON.parse(localStorage.logininfo);
				this.searchLoading = true;
				var params2 = qs.stringify({
					oldbjid:this.form.id,
					newbjid:this.form.bjid,
					pageindex: this.pageindex,
					pagesize: this.pagesize,
					yhid: logininfo.id,
					xxid: logininfo.xxid
				})
				//执行
				this.axios.post(this.$store.state.api + 'bj/getbjxs1', params2)
					.then(res => {
//						console.log(res, 11)
						let data = res.data.data;
						let list = data.list;
						this.xsdataList = list;
						this.total = data.totalPage;
						this.searchLoading = false;
					}).catch(res => {
						this.searchLoading = false;
					})
			},
			handleSizeChange(val) { //每页显示条数触发事件
				this.pagesize = val;
				this.pageindex = 1;
				this.xslist();
			},
			handleCurrentChange(val) { //分页触发事件
				this.xslist();
			},
			checkSelect (selection, row) {//点击单选select触发事件
//				console.log(selection,'ggggggggggggg')
                this.multipleDelNum = selection
                if(this.multipleDelNum.length>0){
                	this.multipleDeleteDisabled = false
                }else{
                	this.multipleDeleteDisabled = true
                }
            },
            checkall (selection) {//点击全选select触发事件
                this.multipleDelNum = selection
                if(this.multipleDelNum.length>0){
                	this.multipleDeleteDisabled = false
                }else{
                	this.multipleDeleteDisabled = true
                }
            },
            tjxx() {
            	 var ids = []
            	 for(var i in this.multipleDelNum){
            	 	ids.push(this.multipleDelNum[i].xsid)
            	 }
				  this.$confirm('确定将选择的学生添加订单吗 ? ', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
//              	alert(ids)
//              	alert(this.form.bjid)
				var logininfo = JSON.parse(localStorage.logininfo);
				var params2 = qs.stringify({
					xsids:ids+'',
					newbjid: this.form.bjid+'',
					yhid: logininfo.id+'',
					xxid: logininfo.xxid+''
				})
				//执行
				this.axios.post(this.$store.state.api + 'bj/insertxsorder', params2)
					.then(res => {
//						console.log(res,'hhhhhhhh')
					if(res.data.code == 1){
						this.$emit('close', { type: 'sj', cancel: false });
						this.$message.success(res.data.msg);
						this.$store.state.loading = false;
					}else{
						this.$message.warning(res.data.msg);
						this.$store.state.loading = false;
					}
					}).catch(res => {
						this.$message.danger("服务器繁忙，请重试");
						this.$store.state.loading = false;
					})
				 }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
              })
			},
			getxzkclist() {
				var logininfo = JSON.parse(localStorage.logininfo);
				this.searchLoading = true;
				var params2 = qs.stringify({
					yhid: logininfo.id,
					xxid: logininfo.xxid
				})
				//执行
				this.axios.post(this.$store.state.api + 'kcfl/getfllist', params2)
					.then(res => {
//						console.log(res, 11)
						this.xzkclist = res.data.data.list;
					}).catch(res => {
//						console.log(res)
					})
			},
			bj() {
				var logininfo = JSON.parse(localStorage.logininfo);
				this.searchLoading = true;
				var params2 = qs.stringify({
					xxid: logininfo.xxid,
					yhid: logininfo.id,
					kcid: this.form.fxkcid
				})
				//执行
				this.axios.post(this.$store.state.api + 'bj/zdgetbjmc', params2)
					.then(res => {
//						console.log(res)
						this.form.mc = res.data.data.list[0].bjmc;
						this.searchLoading = false;
					}).catch(res => {})

			},

			lskb() {
				this.showlskblist = true;
			},
			jslskb() {
				this.showjslskblist = true;
			},
			jskb() {
				this.showjskblist = true;
			},
			jskb2() {
				this.submit(2)

			},
			jslskbcancel(setting) {

				this.showjslskblist = false;
			},
			lskbcancel(setting) {
				//				 if(setting.cancel == false){
				//				 	this.vfxkcid = setting.data[0].id;
				//				 	this.vfxkcidmc = setting.data[0].mc;
				//				 	this.vkssl = setting.data[0].number;
				//				 }
				this.showlskblist = false;
			},
			jskbcancel(setting) {
				//				 if(setting.cancel == false){
				//				 	this.vfxkcid = setting.data[0].id;
				//				 	this.vfxkcidmc = setting.data[0].mc;
				//				 	this.vkssl = setting.data[0].number;
				//				 }
				this.showjskblist = false;
			},

			kaiban() {
				  this.$confirm('确定升级此班级 ? ', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
				var logininfo = JSON.parse(localStorage.logininfo);
				var params2 = qs.stringify({
					bjid: this.form.bjid,
					yhid: logininfo.id,
					xxid: logininfo.xxid
				})
				//执行
				this.axios.post(this.$store.state.api + 'bj/ysj', params2)
					.then(res => {
					if(res.data.code == 1){
						this.$message.success("升级成功!");
						this.$emit('close', {
							type: 'sj',
							cancel: true
						});
					}else{
						this.$message.warning(res.data.msg);
					}
					}).catch(res => {
						this.$message.danger("升级失败!");
					})
				 }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
              })
			},
			getjslist() {
				var logininfo = JSON.parse(localStorage.logininfo);
				var params2 = qs.stringify({
					xxid: logininfo.xxid
				})
				//执行
				this.axios.post(this.$store.state.api + 'xxjs/mc', params2)
					.then(res => {
//						console.log(res,'sssssssssssssssssssss')
						let data = res.data.data;
						this.jslist = data;
					}).catch(res => {})

			},
			everefbjlit() {
				Hub.$emit('change', 'hehe'); //Hub触发事件
			},
		
			showwp() {
				this.showchoselist = true;
			},
			showjc() {
				this.showarticle = true;
			},

			bjxsed(josndata) {
				this.showbjxs = false;
			},
			
			wpchoosecancel(josndata) {
//				console.log(josndata, 111)ss
				if(josndata.data) {
					this.form.jcmc = josndata.data[0].mc;
					this.form.jcid = josndata.data[0].id;
					this.showchoselist = false;
				} else {
					this.showchoselist = false;
				}
			},
			jcarticlecancel() {
				this.showarticle = false;
			},
			bjxscancel() {
				this.showbjxs = false;
			},
			getcomboxlist() {
				var logininfo = JSON.parse(localStorage.logininfo);
				this.searchLoading = true;
				var params2 = qs.stringify({
					xxid: logininfo.xxid
				})
				//执行
				this.axios.post(this.$store.state.api + 'ls/mc', params2)
					.then(res => {
						let data = res.data.data;
						let list = data;
						this.comboxlist = list;
					}).catch(res => {
						this.searchLoading = false;
					})

			},
			getcomboxlist1() {
				var logininfo = JSON.parse(localStorage.logininfo);
				this.searchLoading = true;
				var params2 = qs.stringify({
					xxid: logininfo.xxid
				})
				//执行
				this.axios.post(this.$store.state.api + 'ls/mc', params2)
					.then(res => {
						this.xzlsList = res.data.data;
					}).catch(res => {
					})

			},
			getkblist(){
				var logininfo = JSON.parse(localStorage.logininfo);
				var params2 = qs.stringify({
					xxid: logininfo.xxid,
					yhid: logininfo.id,
					bjid: this.form.bjid+'',
					isys: 'N',
				})
				//执行
				this.axios.post(this.$store.state.api + 'ysbj/getbjkb', params2)
					.then(res => {
						this.kblistul = res.data.data.aa
					}).catch(res => {
						this.$message.warning("服务器异常");
						this.$store.state.loading = false;
					})
			},
			loadinfo() {
//				alert(this.form.id)
				var logininfo = JSON.parse(localStorage.logininfo);
				var params3 = qs.stringify({
					xxid: logininfo.xxid,
					yhid: logininfo.id,
					bjid: this.form.id
				});
				this.axios.post(this.$store.state.api + 'ysbj/ysjbjinfo', params3)
					.then(res => {
						if(res.data.data) {
							console.log(res,'qqqqqq')
							this.form = res.data.data.list[0]
							this.form.bjid = res.data.data.list[0].id
							this.form.mc = res.data.data.list[0].mc
//							this.form.jcmc = res.data.data.list[0].cmc
//							this.form.jcid = res.data.data.list[0].jcid
//							this.form.cid = res.data.data.list[0].cid
							this.form.jcid = res.data.data.list[0].jcid
							this.form.jcmc = res.data.data.list[0].jcmc
							this.form.fxkcmc = res.data.data.list[0].fxkcmc
							this.form.fxkcid = res.data.data.list[0].fxkcid
							this.form.lsmc = res.data.data.list[0].lsmc
							this.form.yjkbrq = res.data.data.list[0].yjkbrq
							this.form.kss = res.data.data.list[0].kss
							this.form.xzid = res.data.data.list[0].xzid
							this.form.kscnt = res.data.data.list[0].kss
							this.form.jsid = res.data.data.list[0].jsid
							this.form.note = res.data.data.list[0].note
							if(res.data.data.list[0].lsid == '0'){
								this.form.lsid = ''
							}
//							else{
////								this.form.lsid = parseInt(res.data.data.list[0].lsid)
//								this.form.lsid = res.data.data.list[0].lsid
//							}
							this.getkblist()
						} else {
						}
					}).catch(res => {
						this.$emit('close', {
							type: 'sj',
							cancel: true
						});
					})
			},
			baocun() {
				this.$store.state.loading = true;
				if(!this.form.mc){
					this.$message.warning("请输入班级名称");
					this.$store.state.loading = false;
					return
				}
				if(!this.form.fxkcid){
					this.$message.warning("请选择课程");
					this.$store.state.loading = false;
					return
				}
				if(!this.form.jcid){
					this.$message.warning("请选择教材");
					this.$store.state.loading = false;
					return
				}
				if(!this.form.lsid){
					this.$message.warning("请选择老师");
					this.$store.state.loading = false;
					return
				}
				if(!this.form.xzid){
					this.$message.warning("请选择行政老师");
					this.$store.state.loading = false;
					return
				}
				if(!this.form.yjkbrq){
					this.$message.warning("请选择开班日期");
					this.$store.state.loading = false;
					return
				}
				this.$store.state.loading = true;
				var time1 = this.$.getLocalTimeNo0(Date.parse(this.form.yjkbrq));
				var logininfo = JSON.parse(localStorage.logininfo);
				var params3 = qs.stringify({
					kscnt: this.form.kscnt + '',
					fxkcid: this.form.fxkcid + '',
					kbrq: time1,
					xzid: this.form.xzid + '',
					jcid: this.form.jcid + '',
					lsid: this.form.lsid + '',
					mc: this.form.mc + '',
					id: this.form.bjid + '',
					note: this.form.note+'',
					yhid: logininfo.id + '',
					xxid: logininfo.xxid + ''
				});
				//执行
				this.axios.post(this.$store.state.api + 'bj/updateysjbj', params3)
					.then(res => {
						if(res.data.code == 1) {
//							this.$emit('close', {type: 'sj',cancel: false});
							this.$message.success("保存成功!");
						    this.bjddlist();
//							this.$store.state.loading = false;
						} else {
							this.$message.warning(res.data.msg);
							this.$store.state.loading = false;
						}
					}).catch(res => {
						this.$message.danger("服务器繁忙，请重试");
						this.$store.state.loading = false;
					})
			},
			submit(type) {
				//装载数据
				var time1 = this.$.getLocalTimeNo0(Date.parse(this.form.yjkbrq));
				var logininfo = JSON.parse(localStorage.logininfo);
				var params2 = qs.stringify({
					kbsjd: time1 + '',
					kscnt: this.form.kscnt + '',
					yjkbrq: time1,
					jsid: this.form.jsid + '',
					sjdid: hstr + '',
					note: this.form.note + '',
					xzid: this.form.xzls + '',
					xxid: logininfo.xxid + '',
					fxkcid: this.form.fxkcid + '',
					jcid: this.form.jcid + '',
					cid: this.form.cid + '',
					lsid: this.form.lsid + '',
					mc: this.form.mc + '',
					id: this.form.id + '',
					yhid: logininfo.id + '',
				})
				// this.everefbjlit();
				//执行
				this.axios.post(this.$store.state.api + 'bj/updatebjsj', params2)
					.then(res => {
						if(type == 1) {
							if(res.data.code == 1) {
								this.$emit('close', {
									type: 'sj',
									cancel: false
								});
//							this.$store.state.loading = false;
							} else {
								this.$message.warning(res.data.msg);
							}
						} else {
							this.showjskblist = true;
							this.showjslskblist = true;
						}

					}).catch(res => {
						this.$message.warning("服务器异常");
					})
			},
			cancel() {
				
				if(this.$route.query.bjmc) {
					this.$emit('close', {
						type: 'sj',
						cancel: true
					})
					this.$router.back(-1)
				} else {
					this.$emit('close', {
						type: 'sj',
						cancel: true
					})
				}
			},

		}
	}
</script>
<style lang="less" scoped>
	.wrap {
		.row {
			height: 50px;
			line-height: 50px;
		}
		.kblistul{
			width: 90%;
			text-align: center;
			margin: 0 auto;
			border: 1px solid;
			overflow: hidden;
			li{
				width: 12.5%;
				height: 100px;
				border: 1px solid;
				float: left;
			}
		}
		.bt {
			position: absolute;
			width: 100%;
			height: 50px;
			margin: 0 auto;
			top: 0;
			left: 0;
			// margin-top: -70px;
			background: #50BFFF;
			// margin-left: -20px;
			// margin-bottom: 20px;
			color: white;
			text-align: left;
			line-height: 50px;
			font-size: 17px;
			padding-left: 15px;
		}
		.jftop1 {
			width: 100%;
			height: 30px;
			overflow: hidden;
			input {
				width: 80px;
				text-align: center;
				border: none;
				outline: none;
				background: transparent;
				border-bottom: 1px solid #ccc;
			}
			.span1 {
				width: 70%;
				height: 100%;
				line-height: 30px;
				border: 1px solid #EBEEF5;
				border-bottom:none;
				float: left;
				padding-left: 20px;
			}
			.span2 {
				width: 20%;
				border: 1px solid #EBEEF5;
				height: 100%;
				line-height: 50px;
				float: left;
				padding-left: 20px;
			}
			.span3 {
				width: 10%;
				border: 1px solid #EBEEF5;
				height: 100%;
				line-height: 50px;
				float: left;
			}
		}
		.close {
			z-index: 10;
			position: absolute;
		}
		.input-block {
			margin-bottom: 20px;
			text-align: center;
		}
		.input {
			width: 280px;
			display: inline-block;
			margin-left: 10px;
		}
		.input1 {
			width: 210px;
			display: inline-block;
			margin-left: 10px;
		}
		.input-block span {
			display: inline-block;
			width: 70px;
			text-align: right;
		}
		.submit {
			width: 120px;
			// display: block;
			// margin: 0 auto;
		}
		.wpfl {
			background: #fff;
			position: absolute;
			top: 5px;
			left: 5px;
		}
		.wpfl1 {
			width: 100%;
			background: #fff;
			position: absolute;
			top: 5px;
			left: -66px;
		}
		.lskb {
			width: 120%;
			background: #fff;
			position: absolute;
			top: 5px;
			left: -66px;
			z-index: 50;
		}
		.form {
			text-align: left;
			margin-top: 10px;
			.zzz {
				width: 100%;
				height: 100%;
				overflow: hidden;
				.an {
					.en1 {
						text-align: left;
						width: 100%;
						padding-left: 30px;
					}
					.en2 {
						width: 100%;
						margin-top: 20px;
						height: 60px;
						margin-bottom: 10px;
						overflow: hidden;
						border-bottom: 1px solid #eee;
						.inp {
							width: 45%;
							float: left;
						}
						.inp2 {
							width: 45%;
							float: left;
							margin-left: 5%;
						}
					}
				}
			}
			.select-block {
				width: 85%;
				display: block;
			}
			.select-block1 {
				width: 63%;
				// display: block;
			}
			.zjselect-block {
				width: 20%;
				float: left;
				display: block;
			}
			.el-form-item {
				margin-bottom: 10px;
			}
			.weekdiv {
				width: 100%;
				height: 100%;
				margin: 0 auto;
				background: lightblue;
			}
			.wdiv0 {
				line-height: 45px;
				width: 110px;
				height: 300px;
				float: left;
				background: lightgoldenrodyellow;
			}
			.wdiv1 {
				width: 50px;
				height: 300px;
				float: left;
				background: lightgoldenrodyellow;
			}
			.wdiv2 {
				width: 50px;
				height: 300px;
				float: left;
				background: lightgoldenrodyellow;
			}
			.wdiv3 {
				width: 50px;
				height: 300px;
				float: left;
				background: lightgoldenrodyellow;
			}
			.wdiv4 {
				width: 50px;
				height: 300px;
				float: left;
				background: lightgoldenrodyellow;
			}
			.wdiv5 {
				width: 50px;
				height: 300px;
				float: left;
				background: lightgoldenrodyellow;
			}
			.wdiv6 {
				width: 50px;
				height: 300px;
				float: left;
				background: lightgoldenrodyellow;
			}
			.wdiv7 {
				width: 50px;
				height: 300px;
				float: left;
				background: lightgoldenrodyellow;
			}
			.el-checkbox+.el-checkbox {
				margin-left: 0px;
			}
		}
	}
</style>